// 字节序测试代码
#include<stdio.h>

typedef union{
	unsigned short int value;
	unsigned char byte[2];
}to;

int main(int argc, char *argv[]){
	to typeorder;
	typeorder.value = 0xabcd;
	if(typeorder.byte[0] == 0xcd){
		printf("小端模式\n");
	}else if(typeorder.byte[0] == 0xab){
		printf("大端模式\n");
	}else{
		printf("not recognized\n");
	}

	return 0;
}